/**

 * @author admin

 * 2014年7月4日

 */

package com.tmall.testgen.common.bo;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.tmall.testgen.common.bo.interact.back.InterceptInfo;

public class BaseUserCenter {
	
	/**
	 * 是否已经启动
	 */
	protected boolean start=false;
	
	
	protected String userId;
	/**
	 * 拦截信息
	 */
	protected String interceptDes;
	/**
	 * mock
	 */
	protected String mockDes;
	/**
	 * 拦截到的用户信息(包含mock
	 */
	protected List<InterceptInfo> infoes;
	
	/**
	 * 用户匹配的拦截信息 <类，<方法,次数>>
	 */
	protected  Map<String, ArrayList<String>> loadedInterceptClassAndMethods;
	
	/**
	 * 用户匹配的mock信息 <类，方法>
	 */
	protected  Map<String,ArrayList<String>> loadedMockClassAndMethods;

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getInterceptDes() {
		return interceptDes;
	}

	public void setInterceptDes(String interceptDes) {
		this.interceptDes = interceptDes;
	}

	public String getMockDes() {
		return mockDes;
	}

	public void setMockDes(String mockDes) {
		this.mockDes = mockDes;
	}

	public List<InterceptInfo> getInfoes() {
		return infoes;
	}

	public void setInfoes(List<InterceptInfo> infoes) {
		this.infoes = infoes;
	}



	public Map<String, ArrayList<String>> getLoadedMockClassAndMethods() {
		return loadedMockClassAndMethods;
	}

	public void setLoadedMockClassAndMethods(
			Map<String, ArrayList<String>> loadedMockClassAndMethods) {
		this.loadedMockClassAndMethods = loadedMockClassAndMethods;
	}
	
	public void addInterceptInfo(InterceptInfo info){
		if(infoes==null){
			infoes=new ArrayList<InterceptInfo>();
		}
		infoes.add(info);
	}
	
	public boolean isLoadedInterceptClassAndMethods(String className){
		if(loadedInterceptClassAndMethods==null)
			return false;
		return loadedInterceptClassAndMethods.get(className)!=null;
	}
	public boolean isLoadedMockClassAndMethods(String className){
		if(loadedMockClassAndMethods==null)
			return false;
		return loadedMockClassAndMethods.get(className)!=null;
	}
	public void addLoadedInterceptClassAndMethods(String className,String method){
		if(loadedInterceptClassAndMethods==null)
			loadedInterceptClassAndMethods=new HashMap<String, ArrayList<String>> ();
		if(loadedInterceptClassAndMethods.get(className)==null)
			loadedInterceptClassAndMethods.put(className, new ArrayList<String>());
		
		loadedInterceptClassAndMethods.get(className).add(method);
	}
	
	public void addLoadedMockClassAndMethods(String className,String method){
		if(loadedMockClassAndMethods==null)
			loadedMockClassAndMethods=new HashMap<String, ArrayList<String>>();
		if(loadedMockClassAndMethods.get(className)==null)
			loadedMockClassAndMethods.put(className, new ArrayList<String>());
		loadedMockClassAndMethods.get(className).add(method);
	}

	public Map<String, ArrayList<String>> getLoadedInterceptClassAndMethods() {
		return loadedInterceptClassAndMethods;
	}

	public void setLoadedInterceptClassAndMethods(
			Map<String, ArrayList<String>> loadedInterceptClassAndMethods) {
		this.loadedInterceptClassAndMethods = loadedInterceptClassAndMethods;
	}

	public boolean isStart() {
		return start;
	}

	public void setStart(boolean start) {
		this.start = start;
	}

	
}
